Accurate RC oscillator having peak - to - peak voltage control

ABSTRACT

An accurate RC oscillator circuit located within a microcontroller chip for generating a signal of a predetermined frequency that accurately oscillates between two precise voltage levels, i.e., a low voltage (VL) and a high voltage (VH) is disclosed. The oscillator circuit uses first and second comparators having their outputs respectively coupled to set and reset inputs of a flip flop. The output of the flip flop is coupled to a series RC network for controlling the charging and discharging of the voltage across a capacitor of the RC network. The interconnection of the series RC network is coupled to an input of both the first and second comparators. The other input of the first comparator is coupled to a circuit for applying a modified high threshold version (VH&#39;) of the high voltage such that the signal generated by the oscillator circuit does not exceed the precise high voltage (VH). Similarly, the other input of the second comparator is coupled to a circuit for applying a modified low threshold version (VL&#39;) of the low voltage such that the signal generated by the oscillator circuit does not fall below that precise low voltage (VL). Additionally, means are provided to select different input voltages for the low voltage (VL) such that the desired output frequency of the oscillator may be adjusted to accurately oscillate between the high voltage (VH) and the selected low voltage (VL).

RELATED APPLICATION

This patent application is related to pending U.S. patent applicationentitled "Accurate RC Oscillator," having Ser. No. 08/499,602 and afiling date of Jul. 11, 1995, now U.S. Pat. No. 5,565,819 in the name ofRussell E. Cooper as inventor, and is incorporated herein by reference.This patent application is also related to pending U.S patentapplication Ser. No. 08/644,914, filed May 24, 1996, entitled"Microcontroller with Firmware Selectable Oscillator Trimming and aMethod Therefor," and filed in the names of Richard Hull and GregoryBingham as inventors and is incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention is in the field of oscillator circuits and methods forgenerating oscillatory signals and, more particularly, is an RCoscillator circuit for oscillating at a predetermined frequency byaccurately oscillating between to precise voltages substantiallyindependent of voltage, temperature, and process variations and a methodtherefore.

2. Description of the Related Art

Oscillator circuits are implemented in many different applications inthe electronics field. RC oscillator circuits usually include a controlcircuit coupled to the interconnection between a seriesresistor-capacitor (RC) network. The control circuit alternately chargesor discharges the voltage across the capacitor through the resistor togenerate an oscillatory signal appearing across the capacitor. Thefrequency of oscillation is determined by the time constant of theresistor and capacitor.

One method for building an RC oscillator is to use a conventional NE555timer (the 555 timer), manufactured by National Semiconductor, as thecircuit that controls the charging and discharging of the capacitor ofthe RC network. The 555 timer includes a set/reset (SR) flip-flop andfirst and second comparators. The interconnection between the series RCnetwork is coupled to one input of each of the comparators. The otherinput of the first comparator is coupled to receive a high thresholdvoltage (Vh) while the other input of the second comparator is coupledto receive a low threshold voltage (Vl). The output of the firstcomparator is coupled to the set input of the flip-flop while the outputof the second comparator is coupled to the reset input of the flip-flop.An output of the flip-flop is coupled to the resistor of the RC network.

In operation, the first comparator sets the flip-flop, which commencesthe discharging of the voltage across the capacitor, when the RCoscillatory signal exceeds the predetermined high threshold voltage, andthe second comparator resets the flip-flop, which commences the chargingof the voltage across the capacitor, when the RC oscillatory signalfalls below the predetermined low threshold voltage. In this manner, thesignal appearing across the capacitor approximately oscillates betweenthe high and low threshold voltages at a frequency determined by thevalue of the resistor and capacitor of the RC network.

However, such a configuration suffers from the drawback that by the timethe flip-flop is set (or reset) in response to the switching of one ofthe comparators, the RC oscillatory signal has actually risen above thehigh threshold voltage (in the case of setting the flip-flop) or hasfallen below the low threshold voltage (in the case of resetting theflip-flop). As a result, variations in the frequency of oscillationoccur because the RC oscillatory signal does not accurately oscillatebetween the desired high and low threshold voltages. Such error can beunacceptable when an accurate oscillatory signal is required.

U.S. Pat. No. 4,122,413 to Chen (the "Chen '413 patent") discloses asingle pin MOS RC oscillator circuit for oscillating between twothreshold levels whose difference remains substantially constant. The RCoscillator circuit includes an external resistor and capacitor connectedin series across power supply terminals of an integrated circuit (IC).The IC controls the charging and discharging of the capacitor. The IC isconnected to the interconnection of the resistor and capacitor, andincludes an MOS switch which is coupled across the capacitor when theswitch is on, the voltage across the capacitor will discharge throughthe resistor, and when the switch is off, the capacitor is chargedthrough the resistor. The IC also includes a pair of inverters havingsimilar but different threshold values, coupled between the resistor andcapacitor. Logic circuitry of the IC is coupled to the pair of invertersand configured such that the switch is as long as the capacitor voltageis below the threshold of both inverters, but the switch is "on" whenthe capacitor voltage exceeds both thresholds. Accordingly, the Chen'413 patent teaches that the voltage across the capacitor will oscillatebetween the two threshold voltages of the inverters at a frequency setby the RC time constant of the RC network. However, as stated in theChen '413 patent, the threshold voltages of the inverters are notprecise and will vary. However, the threshold voltages will vary in thesame direction so that the difference between the threshold voltageswill remain substantially constant. Accordingly, the frequency ofoscillation remains substantially constant.

One area of particular interest in the oscillator art is that ofimplementing an oscillator with a microcontroller. In the past, mostmicrocontroller users would rely on external oscillators to provide anaccurate clock signal to the microcontroller. While this approach hasthe advantage of yielding an accurate clock signal to themicrocontroller; it has the inherent disadvantages of higher costsassociated with using an external clock source and inefficient use ofspace since an external oscillator and its associated components arerequired in addition to the microcontroller. Thus, it would beadvantageous both in terms of cost reduction and space savings to havean oscillator internal to the microcontroller chip itself; however,those skilled in the art know that process variations inherent in themanufacturing procedure would ultimately yield an oscillator having animprecise clock output frequency.

Therefore, there existed a need to provide a microcontroller having aninternal RC oscillator circuit for providing a signal that oscillates ata predetermined frequency by accurately oscillating between precise highand low threshold voltage values while being substantially independentof temperature, power supply, and process variations and a methodtherefor.

SUMMARY OF THE INVENTION

An object of the present invention is to provide a microcontrollerhaving an accurate internal RC oscillator and a method therefor.

Another object of the present invention is to provide a microcontrollerhaving an accurate internal RC oscillator with digital trimming and amethod therefor.

Yet another object of the present invention is to provide amicrocontroller having an accurate internal. RC oscillator whichprovides a precise frequency clock signal substantially independent oftemperature, voltage, and process variations and a method therefor.

BRIEF DESCRIPTION OF THE PREFERRED EMBODIMENTS

According to the present invention, a circuit is disclosed forgenerating an oscillatory signal of a predetermined frequency across aseries resistor-capacitor (RC) network by ensuring that the oscillatorysignal accurately oscillates between first and second voltages generatedfrom a supply voltage source where the frequency of oscillation isdetermined by both the time constant of the RC network and thedifference between the first and second voltages, comprising, incombination, charging-discharging means for discharging a voltage acrossthe capacitor commencing when voltage of the oscillatory signal exceedsa first threshold voltage and for charging the voltage across thecapacitor commencing when voltage of the oscillatory signal falls belowa second threshold voltage, first sampling means coupled to thecharging-discharging means for obtaining a first sampled voltage of theoscillatory signal upon commencement of discharging of the voltageacross the capacitor, first compensation means coupled to the firstsampling means for adjusting the first threshold voltage to be the firstvoltage modified by a voltage difference between the first voltage andthe first sampled voltage, second sampling means coupled to thecharging-discharging means for obtaining a second sampled voltage of theoscillatory signal upon commencement of charging of the voltage acrossthe capacitor, second compensation means coupled to the second samplingmeans for adjusting the second threshold voltage to be the secondvoltage modified by a voltage difference between the second voltage andthe second sampled voltage, and differential voltage setting meanscoupled to the second compensation means for selecting the secondvoltage from a plurality of different possible voltages and therebyselecting a voltage difference between the first and second voltages.The charging-discharging means comprises a flip flop having an outputthereof coupled to the series RC network for controlling the chargingand discharging of the voltage across the capacitor.

The first sampling means comprises a negatively-triggered pulsegenerator having an input connected to an output of thecharging-discharging means, and first switch means coupled to an outputof the negatively triggered pulse generator for momentarily coupling, inresponse to receipt of a pulse from the negatively-triggered pulsegenerator, the first compensation means to the first sampled voltage ofthe oscillatory signal. Similarly, the second sampling means comprises apositively-triggered pulse generator having an input connected to anoutput of the charging-discharging means, and second switch meanscoupled to an output of the positively-triggered pulse generator formomentarily coupling, in response to receipt of a pulse from thepositively-triggered pulse generator, the second compensation means tothe second sampled voltage of the oscillatory signal.

The circuit of the instant invention further comprises first and secondcomparators having their outputs respectively coupled to first andsecond inputs of the flip flop for setting and resetting the flip flop,the first comparator having a connection from its non-inverting input toa node between a resistor and the capacitor of the RC network, and thesecond comparator having a connection from its inverting input to thenode. The first compensation means comprises an amplifier having firstand second inputs and an output, the first input of the amplifier beingcoupled to receive the first voltage, and the output of the amplifierbeing coupled to an inverting input of the first comparator, and acapacitor coupled at one end to the output of the amplifier and coupledat the other end to the second input of the amplifier. Similarly, thesecond compensation means comprises an amplifier having first and secondinputs and an output, the first input of the amplifier being coupled toreceive the second voltage, and the output of the amplifier beingcoupled to the non-inverting input of the second comparator, and acapacitor coupled at one end to the output of the amplifier and coupledat the other end to the second input of the amplifier.

The differential voltage setting means comprises a multiplexer coupledat an input thereof to the supply voltage source and having an outputsupplying the second voltage to the amplifier of the second compensationmeans. The multiplexer has a plurality of input taps each supplying adifferent voltage from the multiplexer to the amplifier of the secondcompensation means when selected. Additionally, the multiplexer includesselection means for selecting one of the plurality of input taps.

Alternatively, the present invention discloses a method for generatingan oscillatory signal of a predetermined frequency across a seriesresistor-capacitor (RC) network by ensuring that the oscillatory signalaccurately oscillates between first and second voltages generated from asupply voltage source where the frequency of oscillation is determinedby both the time constant of the RC network and the difference betweenthe first and second voltages comprising the steps of providingcharging-discharging means for discharging a voltage across thecapacitor commencing when voltage of the oscillatory signal exceeds afirst threshold voltage and for charging the voltage across thecapacitor commencing when voltage of the oscillatory signal falls belowa second threshold voltage, providing first sampling means coupled tothe charging-discharging means for obtaining a first sampled voltage ofthe oscillatory signal upon commencement of discharging of the voltageacross the capacitor, providing first compensation means coupled to thefirst sampling means for adjusting the first threshold voltage to be thefirst voltage modified by a voltage difference between the first voltageand the first sampled voltage, providing second sampling means coupledto the charging-discharging means for obtaining a second sampled voltageof the oscillatory signal upon commencement of charging of the voltageacross the capacitor, providing second compensation means coupled to thesecond sampling means for adjusting the second threshold voltage to bethe second voltage modified by a voltage difference between the secondvoltage and the second sampled voltage, and providing differentialvoltage setting means coupled to the second compensation means forselecting the second voltage from a plurality of different possiblevoltages and thereby selecting a voltage difference between the firstand second voltages. The charging-discharging means comprises a flipflop having an output thereof coupled to the series RC network forcontrolling the charging and discharging of the voltage across thecapacitor.

The step of providing the first sampling means comprises the steps ofproviding a negatively-triggered pulse generator having an inputconnected to an output of the charging-discharging means, and providingfirst switch means coupled to an output of the negatively triggeredpulse generator for momentarily coupling, in response to receipt of apulse from the negatively-triggered pulse generator, the firstcompensation means to the first sampled voltage of the oscillatorysignal. Similarly, the step of providing the second sampling meanscomprises the steps of providing a positively-triggered pulse generatorhaving an input connected to an output of the charging-dischargingmeans, and providing second switch means coupled to an output of thepositively-triggered pulse generator for momentarily coupling, inresponse to receipt of a pulse from the positively-triggered pulsegenerator, the second compensation means to the second sampled voltageof the oscillatory signal.

This method further includes the step of providing first and secondcomparators having their outputs respectively coupled to first andsecond inputs of the flip flop for setting and resetting the flip flop,the first comparator having a connection from its non-inverting input toa node between a resistor and the capacitor of the RC network, and thesecond comparator having a connection from its inverting input to thenode. The step of providing the first compensation means comprises thesteps of providing an amplifier having first and second inputs and anoutput, the first input of the amplifier being couple to receive thefirst voltage, and the output of the amplifier being coupled to aninverting input of the first comparator, and providing a capacitorcoupled at one end to the output of the amplifier and coupled at theother end to the second input of the amplifier, Similarly, the step ofproviding the second compensation means comprises the steps of providingan amplifier having first and second inputs and an output, the firstinput of the amplifier being coupled to receive the second voltage, andthe output of the amplifier being coupled to the non-inverting input ofthe second comparator, and providing a capacitor coupled at one end tothe output of the amplifier and coupled at the other end to the secondinput of the amplifier.

The differential voltage setting means comprises a multiplexer coupledat an input thereof to the supply voltage source and having an outputsupplying the second voltage to the amplifier of the second compensationmeans. Additionally, the multiplexer has a plurality of input taps eachsupplying a different voltage from the multiplexer to the amplifier ofthe second compensation means when selected.

The foregoing and other objects, features, and advantages of theinvention Will be apparent from the following, more particular,description of the preferred embodiments of the invention, asillustrated in the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is simplified electrical schematic view of the RC oscillatorwhich is located within a microcontroller chip (not shown forsimplicity); and

FIG. 2 is a graphical diagram showing an exemplary oscillatory signal ofthe instant invention.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

Referring to FIG. 1, the accurate RC oscillator having peak-to-peakvoltage control (hereinafter referred to simply as the oscillator) isshown and designated by general reference number 10. The oscillator 10is situated on a chip with a microcontroller (not shown), and this is akey feature of the claimed invention since no external, separateoscillator is required with the microcontroller of the instantinvention. The oscillator 10 generates an oscillatory signal of apredetermined frequency by accurately oscillating between precisepredetermined voltage levels, for example, predetermined first andsecond or high and low voltages (VH and VL) respectively. The oscillator10 generates an oscillatory signal at circuit node 12 (i.e., acrosscapacitor 14), that accurately oscillates between high and low voltagevalues (VH and VL). The frequency of oscillation is determined, in part,by the RC time constant of the resistor 22 and the capacitor 14 whereinthe frequency of oscillation is inversely proportional to the product ofthe resistance and capacitance associated with resistor 22 and capacitor14, respectively. The frequency of oscillation is also affected by thedifference between the high and low voltages (VH and VL) since theoscillatory signal at node 12 precisely alternates, peak-to-peak betweenthese voltages. More particularly, for a given RC time constantassociated with resistor 22 and capacitor 14, as the voltage differencebetween VH and VL becomes lower, the frequency of oscillation increases,and vice versa.

The oscillator 10 includes comparators 16 and 18 and SR flip flop 20 allof which comprise the components of a conventional 555 timer.Comparators 16 and 18 have outputs respectively coupled to the set andreset inputs of SR flip flop 20, which can be thought of as acharging-discharging portion for the oscillator 10. Circuit node 12,which is the interconnection of the RC network comprised of capacitor 14and resistor 22, is coupled to the non-inverting input of comparator 16and the inverting input of comparator 18. The inverting input ofcomparator 16 is coupled to receive a modified version of the highvoltage (VH), as represented by high threshold voltage (VH'). Likewise,the non-inverting input of comparator 18 is coupled to receive amodified version of the low voltage (VL), as represented by lowthreshold voltage (VL').

An inverting output flip flop 20 is coupled through resistor 22 tocircuit node W12. The output of flip flop 20 switches between the supplyvoltages applied to flip flop 20, for example, between commonly referredto voltages of Vdd and Vss, depending of whether the flip flop is beingset or reset. For example, when flip flop 20 is set, the invertingoutput of flip flop 20 switches from a logic 1 to a logic 0 and, thus,transitions from voltage Vdd to voltage Vss.

It is noteworthy that although the preferred embodiment utilizes theinverting output of flip flop 20, the non-inverting output (not shown)of flip flop 20 could have been used wherein the connections fromcomparators 16 and 18 to the set and reset inputs of flip flop 20 wouldbe reversed. Alternatively, the inputs of each comparator 16 and 18could be swapped to provide inverted polarity at their respectiveoutputs.

The oscillator 10 includes a first voltage modifying portion comprisinga first sampling portion and a first compensation portion. Similarly,the oscillator 10 includes a second voltage modifying portion,comprising a second sampling portion and a second compensation portion.The first and second voltage modifying portions generate modified highand low threshold voltages (VH' and VL') for application to comparators16 and 18, respectively, based upon the overshoot (of voltage VH) orundershoot (of voltage VL) of the oscillatory signal appearing atcircuit node 12 when flip flop 20 switches. In particular, the firstvoltage modifying portion generates and applies a modified highthreshold voltage VH' to the inverting input of comparator 16 so that bythe time flip flop 20 actually switches in response to the oscillatorysignal exceeding modified high threshold voltage VH', the oscillatorysignal is substantially equal to the predetermined high voltage VH.Similarly, the second voltage modifying portion generates and applies amodified low threshold voltage VL' to the non-inverting input ofcomparator 18 so that by the time flip flop 20 actually switches inresponse to the oscillatory signal falling below modified low thresholdvoltage VL', the oscillatory signal is substantially equal to thepredetermined low voltage VL. In this manner, the instant inventionprovides a signal appearing at circuit node 12 that accuratelyoscillates between voltages VL and VH. This ensures that the signal atcircuit node 12 oscillates at a predetermined and substantially constantfrequency.

As previously stated, the first voltage modifying portion includes thefirst sampling portion and the first compensation portion. The firstsampling portion comprises a negatively-triggered pulse generator 24having an input connected to an output of the charging-dischargingportion or flip flop 20, and a first switch portion 26 coupled to anoutput of the negatively triggered pulse generator 24 for momentarilycoupling, in response to receipt of a pulse from thenegatively-triggered pulse generator 24, the first compensation portionto a first sampled voltage of the oscillatory signal. The negativelytriggered pulse generator 24 provides an output pulse of approximately2-5 nanosecond duration in response to receipt at its input of thefalling edge of the output signal from flip flop 20. Pulse generatorssuch as negatively triggered pulse generator 24 are well known to thoseskilled in the art. The first compensation portion comprises anamplifier 30 and a capacitor 28. The first input of the amplifier iscoupled to receive the first or high voltage (VH), and the output of theamplifier 30 is coupled to the inverting input of the first comparator16. The capacitor 28 is coupled at one end to the output of theamplifier 30, and coupled at the other end to the second input of theamplifier 30.

In operation, amplifier 30 is coupled in a unity gain configuration withfeedback capacitor 28 such that the voltage across capacitor 28 is thevoltage difference between VH' and VH, since amplifier 30 maintains thevoltages appearing at its inverting and non-inverting inputssubstantially equal. Further, voltage VH' is initially set to equalvoltage VH. However, when flip flop 20 switches from a logic high to alogic low, switch 26 momentarily closes (due to negatively triggeredpulse generator and connects circuit node 12 to a first terminal ofcapacitor 28. This forces a sample of the voltage appearing at circuitnode 12 (i.e., voltage of the oscillatory signal) to appear at the firstterminal of capacitor 28. Accordingly, the voltage across capacitor 28will change by the difference between the voltage sampled at circuitnode 12 and voltage VH such that the voltage across the capacitorbecomes more positive if VH>(voltage at circuit node 12) and lesspositive if VH<(voltage at circuit node 12). In this manner, thecapacitor 28 effectively stores this voltage difference. Moreover, onceVH=(voltage at circuit node 12) at the sample time, the voltage acrosscapacitor 28 will not change and the overshoot condition will have beencorrected.

In particular, when the oscillatory signal overshoots voltage VH, thefirst sampled voltage appearing at the first terminal of capacitor 28will be greater then voltage VH. Accordingly, amplifier 30 will respondby lowering the voltage across capacitor 28, and, thus, lowering voltageVH' by the amount of the voltage overshoot. In other words, amplifier 30generates modified high threshold voltage VH' that is equal to thevoltage difference between the first sampled voltage at circuit node 12and voltage VH and applies this voltage VH' to comparator 16. Moreover,because the sample time is very short (i.e., on the order of 2-5nanoseconds), it may take a few iterations from start-up before theoscillatory signal precisely reaches the high voltage VH withoutovershoot. Thereafter, however, comparator 16 will switch when thevoltage at circuit node 12 exceeds voltage VH' such that by the timeflip flop 20 actually switches and begins to discharge the voltage atcircuit node 12, the voltage at circuit node 12 has accurately andprecisely reached the desired high value of VH.

Similarly, as previously stated, the second voltage modifying portionincludes the second sampling portion and the second compensationportion. The second sampling portion comprises a positively-triggeredpulse generator 32 having an input connected to an output of thecharging-discharging portion or flip flop 20, and a second switchportion or simply switch 34 coupled to an output of thepositively-triggered pulse generator 32 for momentarily coupling, inresponse to receipt of a pulse from the positively-triggered pulsegenerator 32, the second compensation portion to a second sampledvoltage of the oscillatory signal. The positively triggered pulsegenerator 32 provides an output pulse of approximately 2-5 nanosecondduration in response to receipt at its input of the rising edge of theoutput signal from flip flop 20. Pulse generators such as positivelytriggered pulse generator 32 are well known to those skilled in the art.The second compensation portion comprises an amplifier 38 and acapacitor 36. The first input of the amplifier 38 is coupled to receivethe second or low voltage (VL), and the output of the amplifier 38 iscoupled to the non-inverting input of the second comparator 18. Thecapacitor 36 is coupled at one end to the output of the amplifier 38,and coupled at the other end to the second input of the amplifier 38.

Similar to amplifier 30, amplifier 38 is coupled in a unity gainconfiguration with feedback capacitor 36 such that the voltage acrosscapacitor 36 is the voltage difference between VL' and VL. Further,voltage VL' is initially set to equal voltage VL. When flip flop 20switches from a logic low to a logic high, switch 34 momentarily closes(due to positively triggered pulse generator 32) and connects circuitnode 12 to the first terminal of capacitor 36. This forces a sample ofthe voltage appearing at circuit node 12 to appear at the first terminalof capacitor 36. Accordingly, the voltage across capacitor 36 willchange by the difference between the voltage sampled at circuit node 12and voltage VL, and capacitor 36 effectively stores this voltagedifference. For example, when the oscillatory signal undershoots voltageVL, the sampled voltage appearing at the first terminal of capacitor 36will be less than voltage VL. Accordingly, amplifier 38 will respond byincreasing the voltage across capacitor 36 and, thus, increasing voltageVL' by the voltage amount equal to the voltage difference between thesecond sampled voltage and voltage VL and apply this voltage tocomparator 18. Again, because the sample time is very short (i.e., 2-5nanoseconds), it may take a few iterations before the oscillatory signalprecisely reaches the low voltage VL with no undershoot. Thereafter,comparator 18 will switch when the voltage at circuit node 12 exceedsvoltage VL' such that by the time flip flop 20 actually switches andbegins to charge the voltage at circuit node 12, the voltage at circuitnode 12 has accurately reached the desired low voltage VL.

The portions of the oscillator 10 discussed up until this point providea signal which oscillates at a predetermined frequency between low andhigh voltages VL and VH. Since the frequency of the oscillating signalis a function of both the RC time constant associated with resistor 22and capacitor 14 and the voltage difference between the voltages VL andVH, controlling this voltage difference will also control the frequencyof the oscillating signal from the oscillator 10. Thus, the differentialvoltage setting portion is provided for selecting the second or lowvoltage (VL) from a plurality of .different possible voltages, therebyselecting the voltage difference between the first or high (VH) andsecond or low (VL) voltages. The differential voltage setting portioncomprises a multiplexer 40 coupled at an input thereof to the supplyvoltage source Vdd and having an output supplying the second or lowvoltage (VL) to amplifier 38 of the second compensation portion. Themultiplexer 40 has a plurality of input taps 44 each supplying adifferent voltage from the multiplexer 40 to the amplifier 38 whenselected. The multiplexer 40 includes a selection or digital adjustportion 42 for selecting one of the plurality of input taps 44. Thedigital adjust portion 42 comprises n lines of digital data for themultiplexer 40. Thus, the digital adjust portion 42 can address 2^(n)input taps 44 from R0 to R(2^(n) -1). Between each input tap 44 isanother resistor 46 to provide different voltage levels to themultiplexer 40. Also note that between the voltage source Vdd and groundare setting resistors 48 and 50. The digital adjust portion 42 data canbe provided from memory on the microcontroller chip or from othersources, as desired.

Referring to FIG. 2 a graphical diagram shows an exemplary oscillatorysignal of the instant invention wherein the signal oscillates betweenpredetermined high and low voltages VH and VL.

Although the invention has been particularly shown and described withreference to a preferred embodiment thereof, it will be understood bythose skilled in the art that changes in form and detail may be madetherein without departing from the spirit and scope of the invention.

What is claimed is:
 1. A circuit for generating an oscillatory signal ofa predetermined frequency across a series resistor-capacitor (RC)network by ensuring that the oscillatory signal accurately oscillatesbetween first and second voltages generated from a supply voltage sourcewhere the frequency of oscillation is determined by both the timeconstant of the RC network and the difference between the first andsecond voltages, comprising, in combination:charging-discharging meansfor discharging a voltage across the capacitor commencing when voltageof the oscillatory signal exceeds a first threshold voltage and forcharging said voltage across the capacitor commencing when voltage ofthe oscillatory signal falls below a second threshold voltage; firstsampling means coupled to said charging-discharging means for obtaininga first sampled voltage of the oscillatory signal upon commencement ofdischarging of said voltage across the capacitor; first compensationmeans coupled to said first sampling means for adjusting said firstthreshold voltage to be the first voltage modified by a voltagedifference between the first voltage and said first sampled voltage;second sampling means coupled to said charging-discharging means forobtaining a second sampled voltage of the oscillatory signal uponcommencement of charging of said voltage across the capacitor; secondcompensation means coupled to said second sampling means for adjustingsaid second threshold voltage to be the second voltage modified by avoltage difference between the second voltage and said second sampledvoltage; and differential voltage setting means coupled to said secondcompensation means for selecting the second voltage from a plurality ofdifferent possible voltages and thereby selecting a voltage differencebetween the first and second voltages.
 2. The circuit of claim 1 whereinsaid charging-discharging means comprises a flip flop having an outputthereof coupled to the series RC network for controlling the chargingand discharging of said voltage across the capacitor.
 3. The circuit ofclaim 1 wherein said first sampling means comprises:anegatively-triggered pulse generator having an input connected to anoutput of said charging-discharging means; and first switch meanscoupled to an output of said negatively triggered pulse generator formomentarily coupling, in response to receipt of a pulse from saidnegatively-triggered pulse generator, said first compensation means tosaid first sampled voltage of the oscillatory signal.
 4. The circuit ofclaim 1 wherein said second sampling means comprises:apositively-triggered pulse generator having an input connected to anoutput of said charging-discharging means; and second switch meanscoupled to an output of said positively-triggered pulse generator formomentarily coupling, in response to receipt of a pulse from saidpositively-triggered pulse generator, said second compensation means tosaid second sampled voltage of the oscillatory signal.
 5. The circuit ofclaim 2 further comprising first and second comparators having theiroutputs respectively coupled to first and second inputs of said flipflop for setting and resetting said flip flop, said first comparatorhaving a connection from its non-inverting input to a node between aresistor and the capacitor of the RC network, and said second comparatorhaving a connection from its inverting input to said node.
 6. Thecircuit of claim 5 wherein said first compensation means comprises:anamplifier having first and second inputs and an output, said first inputof said amplifier being coupled to receive the first voltage, and saidoutput of said amplifier being coupled to an inverting input of saidfirst comparator; and a capacitor coupled at one end to the output ofthe amplifier and coupled at the other end to the second input of theamplifier.
 7. The circuit of claim 6 wherein said second compensationmeans comprises:an amplifier having first and second inputs and anoutput, said first input of said amplifier being coupled to receive thesecond voltage; and said output of said amplifier being coupled to thenon-inverting input of said second comparator; and a capacitor coupledat one end to the output of the amplifier and coupled at the other endto the second input of the amplifier.
 8. The circuit of claim 7 whereinsaid differential voltage setting means comprises a multiplexer coupledat an input thereof to the supply voltage source and having an outputsupplying the second voltage to said amplifier of said secondcompensation means.
 9. The circuit of claim 8 wherein said multiplexerhas a plurality of input taps each supplying a different voltage fromsaid multiplexer to said amplifier of said second compensation meanswhen selected.
 10. The circuit of claim 9 wherein said multiplexerincludes selection means for selecting one of said plurality of inputtaps, and wherein said circuit is located on a chip with amicrocontroller.
 11. A method for generating an oscillatory signal of apredetermined frequency across a series resistor-capacitor (RC) networkby ensuring that the oscillatory signal accurately oscillates betweenfirst and second voltages generated from a supply voltage source wherethe frequency of oscillation is determined by both the time constant ofthe RC network and the difference between the first and second voltagescomprising the steps of:providing charging-discharging means fordischarging a voltage across the capacitor commencing when voltage ofthe oscillatory signal exceeds a first threshold voltage and forcharging said voltage across the capacitor commencing when voltage ofthe oscillatory signal falls below a second threshold voltage; providingfirst sampling means coupled to said charging-discharging means forobtaining a first sampled voltage of the oscillatory signal uponcommencement of discharging of said voltage across the capacitor;providing first compensation means coupled to said first sampling meansfor adjusting said first threshold voltage to be the first voltagemodified by a voltage difference between the first voltage and saidfirst sampled voltage; providing second sampling means coupled to saidcharging-discharging means for obtaining a second sampled voltage of theoscillatory signal upon commencement of charging of said voltage acrossthe capacitor; providing second compensation means coupled to saidsecond sampling means for adjusting said second threshold voltage to bethe second voltage modified by a voltage difference between the secondvoltage and said second sampled voltage; and providing differentialvoltage setting means coupled to said second compensation means forselecting the second voltage from a plurality of different possiblevoltages and thereby selecting a voltage difference between the firstand second voltages.
 12. The method of claim 11 wherein saidcharging-discharging means comprises a flip flop having an outputthereof coupled to the series RC network for controlling the chargingand discharging of said voltage across the capacitor.
 13. The method ofclaim 11 wherein the step of providing said first sampling meanscomprises the steps of:providing a negatively-triggered pulse generatorhaving an input connected to an output of said charging-dischargingmeans; and providing first switch means coupled to an output of saidnegatively triggered pulse generator for momentarily coupling, inresponse to receipt of a pulse from said negatively-triggered pulsegenerator, said first compensation means to said first sampled voltageof the oscillatory signal.
 14. The method of claim 11 wherein the stepof providing said second sampling means comprises the steps of:providinga positively-triggered pulse generator having an input connected to anoutput of said charging-discharging means; and providing second switchmeans coupled to an output of said positively-triggered pulse generatorfor momentarily coupling, in response to receipt of a pulse from saidpositively-triggered pulse generator, said second compensation means tosaid second sampled voltage of the oscillatory signal.
 15. The method ofclaim 12 further comprising the step of providing first and secondcomparators having their outputs respectively coupled to first andsecond inputs of said flip flop for setting and resetting said flipflop, said first comparator having a connection from its non-invertinginput to a node between a resistor and the capacitor of the RC network,and said second comparator having a connection from its inverting inputto said node.
 16. The method of claim 15 wherein the step of providingsaid first compensation means comprises the steps of:providing anamplifier having first and second inputs and an output, said first inputof said amplifier being coupled to receive the first voltage, and saidoutput of said amplifier being coupled to an inverting input of saidfirst comparator; and providing a capacitor coupled at one end to theoutput of the amplifier and coupled at the other end to the second inputof the amplifier.
 17. The method of claim 15 wherein the step ofproviding said second compensation means comprises the stepsof:providing an amplifier having first and second inputs and an output,said first input of said amplifier being coupled to receive the secondvoltage, and said output of said amplifier being coupled to thenon-inverting input of said second comparator; and providing a capacitorcoupled at one end to the output of the amplifier and coupled at theother end to the second input of the amplifier.
 18. The method of claim17 wherein said differential voltage setting means comprises amultiplexer coupled at an input thereof to the supply voltage source andhaving an output supplying the second voltage to said amplifier of saidsecond compensation means.
 19. The method of claim 18 wherein saidmultiplexer has a plurality of input taps each supplying a differentvoltage from said multiplexer to said amplifier of said secondcompensation means when selected.
 20. A circuit for generating anoscillatory signal of a predetermined frequency across a seriesresistor-capacitor (RC) network by ensuring that the oscillatory signalaccurately oscillates between first and second voltages generated from asupply voltage source and where the frequency of oscillation isdetermined by both the time constant of the RC network and by thedifference between the first and second voltages, the circuit includingfirst and second comparators having their outputs respectively coupledto first and second inputs of a flip flop for setting and resetting theflip flop, an output of the flip flop being coupled to the series RCnetwork for controlling the charging and discharging of voltage acrossthe capacitor, the interconnection of the series RC network beingcoupled to an input of both the first and second comparators, theimprovement comprising:first voltage modifying means for receiving thefirst voltage and for applying a modified version of the first voltageto the other input of the first comparator such that the firstcomparator switches before the oscillatory signal actually reaches thefirst voltage thereby ensuring that the oscillatory signal preciselyreaches the first voltage by the time the flip flop switches; secondvoltage modifying means for receiving the second voltage and forapplying a modified version of the second voltage to the other input ofthe second comparator such that the second comparator switches beforethe oscillatory signal actually reaches the second voltage therebyensuring that the oscillatory signal precisely reaches the secondvoltage by the time the flip flop switches; differential voltage settingmeans coupled to said second voltage modifying means for selecting thesecond voltage from a plurality of different possible voltages andthereby selecting a voltage difference between the first and secondvoltages; and said circuit being located on a chip with amicrocontroller.